﻿using ManagementApi.Models;
using Modules.System.Area;
using Modules.System.Dept;
using PmSoft;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ManagementApi
{
    /// <summary>
    /// 单位信息局部扩展类
    /// </summary>
    public static partial class DeptExceptions
    {

        /// <summary>
        /// 获取部门下拉tree
        /// </summary>
        /// <param name="depts"></param>
        /// <returns></returns>
        public static IEnumerable<VueTree<int>> AsTrees(this IEnumerable<SysDept> depts)
        {
            List<VueTree<int>> trees = new();
            foreach (var item in depts)
            {
                VueTree<int> tree = new()
                {
                    Label = item.Name,
                    Value = item.DeptId
                };
                trees.Add(tree);
            }
            return trees;
        }

    }
}
